﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Galaxy.AutoCAD.Arithmetics
{
    public class LinearFunction
    {
        #region 一次函数构造函数
        public LinearFunction(double k, double b)
        {
            _k = k;
            _b = b;
        }
        #endregion
        #region 定义一次函数b值属性
        private double _b = 0;
        public double b
        {
            get
            {
                return _b;
            }
            set
            {
                _b = value;
            }
        }
        #endregion
        #region 定义一次函数k值属性
        private double _k = 1;
        public double k
        {
            get
            {
                return _k;
            }
            set
            {
                if (value == 0)
                {
                    throw new Exception("一次函数k值不能为0");
                }
                else
                {
                    _k = value;
                }
            }
        }
        #endregion
    }
    public enum ConstantFunctionKind
    {
        X,
        Y
    }
    public class ConstantFunction
    {
        #region 常数函数构造函数
        public ConstantFunction(ConstantFunctionKind sfk, double b)
        {
            _constantfunctionkind = sfk;
            _b = b;
        }
        #endregion
        #region 定义常数函数b值属性
        private double _b = 0;
        public double b
        {
            get
            {
                return _b;
            }
            set
            {
                _b = value;
            }
        }
        #endregion
        #region 定义常数函数种类属性
        private ConstantFunctionKind _constantfunctionkind = ConstantFunctionKind.X;
        public ConstantFunctionKind ConstantFunctionKind
        {
            get
            {
                return _constantfunctionkind;
            }
            set
            {
                _constantfunctionkind = value;
            }
        }
        #endregion
    }
}
